package com.example.service.friendship.controller;

import com.example.common.ResponseVO;
import com.example.service.friendship.model.req.ApproverFriendRequestReq;
import com.example.service.friendship.model.req.GetFriendShipRequestReq;
import com.example.service.friendship.model.req.ReadFriendShipRequestReq;
import com.example.service.friendship.service.ImFriendShipRequestService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;


@RestController
@RequestMapping("v1/friendshipRequest")
@Api(tags = "好友验证接口")
public class ImFriendShipRequestController {

    @Autowired
    ImFriendShipRequestService imFriendShipRequestService;

    @PostMapping("/approveFriendRequest")
    @ApiOperation(value = "通过好友验证")
    public ResponseVO approveFriendRequest(@RequestBody @Validated
                                           ApproverFriendRequestReq req){  //, Integer appId, String identifier
//        req.setAppId(appId);
//        req.setOperater(identifier);
        return imFriendShipRequestService.approverFriendRequest(req);
    }
    @GetMapping("/getFriendRequest")
    @ApiOperation(value = "获取好友请求列表")
    public ResponseVO getFriendRequest( @Validated GetFriendShipRequestReq req){ //,Integer appId  @RequestBody
//        req.setAppId(appId);
        return imFriendShipRequestService.getFriendRequest(req.getToId(),req.getAppId());
    }

    @PostMapping("/readFriendShipRequestReq")
    @ApiOperation(value = "修改请求好友的看没看的状态")
    public ResponseVO readFriendShipRequestReq(@RequestBody @Validated ReadFriendShipRequestReq req){ //,Integer appId
//        req.setAppId(appId);
        return imFriendShipRequestService.readFriendShipRequestReq(req);
    }







}
